using System;
using System.Collections.Generic;
using System.IO;
using System.Text;

namespace Universe.Farm.Service.Mesages
{
    class ByeMessage : IMessage
    {
        private MessageHeader _messageHeader;
        private string _computer;

        public ByeMessage()
        {
        }

        public ByeMessage(MessageHeader messageHeader)
        {
            _messageHeader = messageHeader;
        }

        public string Computer
        {
            get { return _computer; }
            set { _computer = value; }
        }

        void IMessage.Serialize(BinaryWriter writer)
        {
            _messageHeader.Serialize(writer);
            writer.Write(_computer);
        }

        void IMessage.Parse(BinaryReader reader)
        {
            _messageHeader = MessageHeader.Parse(reader);
            _computer = reader.ReadString();
        }

        public MessageHeader MessageHeader
        {
            get { return _messageHeader; }
        }
    }
}
